﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using PatternLockControl.Code;

namespace TestPatternLock
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent(); 
            this.pattLoc.PatternToMatch = new List<int>() { 0, 1, 2, 5, 8 };
            this.pattLoc.PatternMatchSuccess += pattLoc_PatternMatchSuccess;
            this.pattLoc.RegistrationSuccess += pattLoc_RegistrationSuccess;
            this.pattLoc.IsRegisterationMode = true;
        }

        void pattLoc_RegistrationSuccess(object sender, RegistrationSuccessEventArg e)
        {
            var pass = e.RegistrationCode;
            MessageBox.Show("Password Successfully Registered");
        }

        void pattLoc_PatternMatchSuccess(object sender, PatternMatchSuccessEventArg e)
        {
            var pass = e.IsSuccess;
            MessageBox.Show("Password Successfully Matched");
        }

        private void RadioButton_Checked(object sender, System.Windows.RoutedEventArgs e)
        {
            if (this.pattLoc != null)
                this.pattLoc.IsRegisterationMode = true;
        }

        private void RadioButton_Checked_1(object sender, System.Windows.RoutedEventArgs e)
        {
            this.pattLoc.IsRegisterationMode = false;
        }
    }
}